package com.hitales.liteflow.liteflowdemo.contextdemo;

import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class LiteflowTestService {
    @Autowired
    private FlowExecutor flowExecutor;

    public void test() {
        ArrayList<String> strings = new ArrayList<>();
        strings.add("hello");
        strings.add("world");

        LiteflowResponse response = flowExecutor.execute2Resp("contextdemo", strings, CustomContext.class);
        CustomContext context = response.getFirstContextBean();
        System.out.println("流程结束后上下文: userId=" + context.getUserId() + ", age=" + context.getAge());
    }
}
